]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
keyboard: Don't press and release keyval if it's a modifier key
authorJonas Dreßler <verdre@v0yd.nl>
Sun, 17 Nov 2024 18:16:58 +0000 (19:16 +0100)
committerFlorian Müllner <fmuellner@gnome.org>
Sat, 23 Nov 2024 12:18:50 +0000 (13:18 +0100)
Looks like we currently do the press-and-release dance for keys that specify
both a keyval and the "modifier" action. So when pressing CTRL in the
extended OSK, not only is the CTRL modifier set together with the next key
pressed, but the actual CTRL keyval quickly gets pressed and released,
similar to how we'd do it for the TAB key.

This seems unintentional, as the press-and-release behavior should probably
be specific to keys like TAB, and not apply to modifier keys, so limit that
behavior to only keys without an action specified.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3286>
(cherry picked from commit cae8b745cab97056d7fee9aa30053817f44f53ad)

js/ui/keyboard.js

index a42c6ca872c701da7f51d20c7b08b892e41b3325..4f41bc1bdb966eb33d4738683814b2d1eb5f4ee6 100644 (file)
@@ -1491,28 +1491,6 @@ export const Keyboard = GObject.registerClass({
                 keyval: key.keyval,
             }, strings);
 
-            if (key.keyval) {
-                button.connect('keyval', (_actor, keyval) => {
-                    this._keyboardController.keyvalPress(keyval);
-                    this._keyboardController.keyvalRelease(keyval);
-                });
-            }
-
-            if (key.action !== 'modifier') {
-                button.connect('commit', (_actor, str) => {
-                    this._keyboardController.commit(str, this._modifiers).then(() => {
-                        this._disableAllModifiers();
-                        if (layout.mode === 'default' ||
-                            (layout.mode === 'latched' && !this._latched)) {
-                            if (this._contentHint !== 0)
-                                this._updateLevelFromHints();
-                            else
-                                this._setActiveLevel('default');
-                        }
-                    }).catch(console.error);
-                });
-            }
-
             if (key.action) {
                 button.connect('released', () => {
                     if (key.action === 'hide') {
@@ -1535,6 +1513,24 @@ export const Keyboard = GObject.registerClass({
 
                     this._longPressed = false;
                 });
+            } else if (key.keyval) {
+                button.connect('keyval', (_actor, keyval) => {
+                    this._keyboardController.keyvalPress(keyval);
+                    this._keyboardController.keyvalRelease(keyval);
+                });
+            } else {
+                button.connect('commit', (_actor, str) => {
+                    this._keyboardController.commit(str, this._modifiers).then(() => {
+                        this._disableAllModifiers();
+                        if (layout.mode === 'default' ||
+                            (layout.mode === 'latched' && !this._latched)) {
+                            if (this._contentHint !== 0)
+                                this._updateLevelFromHints();
+                            else
+                                this._setActiveLevel('default');
+                        }
+                    }).catch(console.error);
+                });
             }
 
             if (key.action === 'levelSwitch' &&